package com.example.qxfw.qhtztj.controller;
import com.example.qxfw.common.SysResult;
import com.example.qxfw.qhtztj.entity.SumHumidityData;
import com.example.qxfw.qhtztj.service.SumHumidityDataService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author BEJSON
 * @description sum_rain_year_data
 */
@CrossOrigin
@RestController
@RequestMapping(value = "/sumHumidityData")
public class SumHumidityDataController {

    @Autowired
    private SumHumidityDataService sumHumidityDataService;

    /**
     * 获取湿度总和数据
     * @author pengdongdong
     * @date 2024/11/29
     **/
    @GetMapping("/getSumHumidityData")
    public SysResult getSumHumidityData(SumHumidityData sumHumidityData) {
        String indicatorName = sumHumidityData.getSumindicatorname();
        //查询气象数据
            if(indicatorName.equals("开春期") || indicatorName.equals("入冬期") || indicatorName.equals("初霜期")|| indicatorName.equals("终霜期"))
                return SysResult.success(sumHumidityDataService.getWeatherData(sumHumidityData));
            if(indicatorName.equals("最大风向/频率") || indicatorName.equals("极大风向/频率") )
                return SysResult.success(sumHumidityDataService.getWindDrectionData(sumHumidityData));
        return SysResult.success(sumHumidityDataService.getData(sumHumidityData));
    }

//    /**
//     * 导出短信信息
//     *
//     * @param response
//     */
//    @PostMapping("/excelData")
//    public void excelSMS(SumHumidityData sumHumidityData, HttpServletResponse response) throws IOException {
//        List<SumHumidityDataVo> list = sumHumidityDataService.getSumHumidityData(sumHumidityData);
//        ExcelUtil<SumHumidityDataVo> excelUtil = new ExcelUtil<>(SumHumidityDataVo.class);
//        excelUtil.exportExcel(response, list, "sumHumidityData", "SumData");
//    }

}
